package com.example.store.controller;


import com.example.store.entity.District;
import com.example.store.service.IDistrictService;
import com.example.store.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("districts")
public class DistrictContronller extends BaseController {
    @Autowired
    private IDistrictService districtService;

    @RequestMapping({"","/"})
    public JsonResult<List<District>> getByParent(String parent){
        List<District> list = districtService.getByParent(parent);
        return new JsonResult<>(OK,list);
    }
}
